package beans.thread.lululu;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.net.Socket;

public class socketClient
{
	Socket socket;
	BufferedReader in;
	PrintWriter out;

	public socketClient()
	{
		try
		{
			socket = new Socket("127.0.0.1", 3131);

			OutputStream bw = socket.getOutputStream();
			bw.write("aaaaa".getBytes());

			// 接收服务器的反馈
			DataInputStream reader = new DataInputStream(socket.getInputStream());

			byte[] bs = new byte[5];
			for (int i = 0; i < 5; i++)
			{
				byte b = reader.readByte();
				bs[i] = b;
			}

			System.out.println(new String(bs, "UTF-8"));
			// bw.close();
			// line.close();
			// out.close();
			// in.close();
			// socket.close();
		}
		catch (IOException e)
		{
		}
	}
}
